export default (_self, h) => {
  return h(
    "el-upload",
    {
      props: {
        "file-list": _self.obj.value||[],
        action: _self.obj.action,
        "list-type": "picture-card",
        "on-preview": (file) => {
          _self.obj.dialogImageUrl = file.url;
          _self.obj.dialogVisible = true;
        },
        "on-remove": (file, fileList) => {
          _self.obj.value = fileList;
        },
        "on-success": (response, file, fileList) => {
          _self.obj.value = fileList;
        },
        disabled: !_self.obj.status,
      },
      attrs: {},
      style: {
        cursor: !_self.obj.status ? "not-allowed" : "",
      },
    },
    [
      h("i", {
        class: ["el-icon-plus", "avatar-uploader-icon"],
      }),
      h(
        "el-dialog",
        {
          props: {
            visible: _self.obj.dialogVisible,
            "append-to-body": true,
            "modal-append-to-body": true,
          },
          on: {
            close: () => {
              _self.obj.dialogVisible = false;
            },
          },
        },
        [
          h("img", {
            attrs: {
              width: "100%",
              src: _self.obj.dialogImageUrl,
            },
          }),
        ]
      ),
    ]
  );
};

export let imageConf = {
  status: true, // 启用状态，0启用；1停用
  elementWidth: "100%",
  elementType: "image", // 对应数据库内类型
  elementName: "图 片", // 控件左侧label内容
  value: undefined,
  action: "https://jsonplaceholder.typicode.com/posts/",
  dialogVisible: false,
  dialogImageUrl: "",
  icon: "el-icon-picture",
  required: false, // 是否必填
  rules:[]

};
